<?php
class AppController extends Controller {
	var $components = array('Acl', 'Auth');	
	
	function beforeFilter() {

		//Configure AuthComponent
		$this->Auth->authorize = 'actions';
		$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
		$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
		$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'welcome');
		
		$this->Auth->actionPath = 'controllers/';
		$this->Auth->allowedActions = array('display');	
		
		//如果是管理员请求，使用admin模板
		if (isset($this->params['admin'])) {
	            $this->layout = 'admin';
        }
		
        //过滤输入信息
        App::import('Sanitize');        
        
		$this->Auth->loginError = "用户名或密码不正确，请重试！";
		$this->Auth->authError = "抱歉，你没有使用该功能的权限！";
	}
}
?>